package top.superflow.version.db.data

import top.superflow.db.api.DBIndex
import top.superflow.exception.RequestUnsupportedException
import top.superflow.log.Loggable
import top.superflow.verify.Ensure
import top.superflow.version.db.IndexVersion

class DBIndexVersion (originalIndex : Any) extends IndexVersion with Ensure with Loggable{
 
  notNull(originalIndex)
  
  originalIndex match {
    case index : DBIndex =>{
      this.name.compareAndSet(this.name.get, index.name)
      this.columnList ++= index.fieldList
      this.unique.compareAndSet(this.unique.get, index.unique)
    }
    case _ => {
      throw new RequestUnsupportedException("The passed in parameter is type of " + originalIndex)
    }
  }
  
}